home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 December / PCWorld_2007-12_cd.bin / domacnost a kancelar / autoit / autoit-v3-setup.exe / Examples / Helpfile / _SoundPause.au3 < prev    next >
Text File  |  2007-09-08  |  1KB  |  28 lines

  1. #include <Sound.au3>
  2. ;open sound file
  3. $sound = _SoundOpen(@WindowsDir & "\media\Windows XP Startup.wav", "Startup")
  4. If @error = 2 Then
  5.     MsgBox(0, "Error", "The file does not exist")
  6.     Exit
  7. ElseIf @error = 3 Then
  8.     MsgBox(0, "Error", "The alias was invalid")
  9.     Exit
  10. ElseIf @extended <> 0 Then
  11.     $extended = @extended ;assign because @extended will be set after DllCall
  12.     $stText = DllStructCreate("char[128]")
  13.     $errorstring = DllCall("winmm.dll","short","mciGetErrorStringA","str",$extended,"ptr",DllStructGetPtr($stText),"int",128)
  14.     MsgBox(0, "Error", "The open failed." & @CRLF & "Error Number: " & $extended & @CRLF & "Error Description: " & DllStructGetData($stText, 1) & @CRLF & "Please Note: The sound may still play correctly.")
  15. Else
  16.     MsgBox(0, "Success", "The file opened successfully")
  17. EndIf
  18. _SoundPlay($sound)
  19. Sleep(1000)
  20. _SoundPause($sound)
  21. Sleep(1000)
  22. _SoundResume($sound)
  23. While 1
  24.     Sleep(100)
  25.     If _SoundPos($sound, 2) = _SoundLength($sound, 2) Then ExitLoop
  26. WEnd
  27.  
  28. _SoundClose($sound)